



const dateTimeUtils={
  dateTimeFormat:(dateTime)=>{
    let year = dateTime.getFullYear(); //得到年份
    let month = dateTime.getMonth() + 1;//得到月份
    let date = dateTime.getDate();//得到日期
    if (month<10)
      month="0"+month
    if (date<10)
      date="0"+date
    return  year+"-"+ month+"-"+date+"T00:00:00";
  },
  dateTimePlusMinus:(dateTime,days)=>{
    return new Date(dateTime.getTime() + days * 24 * 60 * 60 * 1000)
  },

  /**
   * 获取任意时间
   */
  myGetDate:(date, AddDayCount = 0)=>{
  if (!date) {
    date = new Date()
  }
  if (typeof date !== 'object') {
    date = date.replace(/-/g, '/')
  }
  const dd = new Date(date)

  dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期

  const y = dd.getFullYear()
  const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期，不足10补0
  const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号，不足10补0
  return {
    fullDate: y + '-' + m + '-' + d,
    year: y,
    month: m,
    date: d,
    day: dd.getDay()
  }
}
};

export default dateTimeUtils